package com.ly.mpayment.persist.service.matchingstrategy;

import java.util.List;
import java.util.Map;

import com.ly.mpayment.persist.entity.DownShopProduct;
import com.ly.mpayment.persist.entity.MatchingStrategy;
import com.ly.mpayment.persist.entity.UpShopProduct;
import com.ly.mpayment.persist.entity.User;
import com.ly.mpayment.persist.hibernate.Page;
import net.sf.json.JSONObject;

public interface IMatchingStrategyService {

	public boolean addMatchingstrategy(MatchingStrategy match, DownShopProduct product);

	public boolean addMatchingstrategy(MatchingStrategy match);

	public boolean updateMatchingstrategy(MatchingStrategy match);

	public MatchingStrategy findById(String id);

	public Page<MatchingStrategy> findPageMatchingstrategy(Map<String, Object> parameters ,int start,int pageSize);

	public boolean deleteStrategy(MatchingStrategy match);

	/**
	 * 查询产品对应的策略
	 * @param productUuid
	 * @return
	 */
	public MatchingStrategy findByProduct(String productUuid);

	public boolean deleteMatech(String productUuid,String useruuid,String provinceuuid,String operatoruid,String busuuid,String cityName);

	public boolean deleteMatechUp(String useruuid,String provinceuuid,String operatoruid,String busuuid,String productUuid,String cityName,String facevalue);

	public boolean deleteMatechDown(String useruuid,String provinceuuid,String operatoruid,String busuuid,String productUuid,String cityName,String facevalue);

	/**
	 * 按下游产品编码删除配置
	 * @param productUuid
	 * @return
	 */
	public boolean deleteMatechDownProduct(String productUuid);

	/**
	 * 查询产品对应的策略 并且抓取 策略明细
	 * @return
	 */
	public MatchingStrategy findByProductFetchInclu(String downUuid);

	public MatchingStrategy findByProductFetchIncluDown(String downUuid,String upProductId);

	/**
	 * 按分销用户查询手动匹配上游策略
	 * @param useruuid
	 * @return
	 */
	List<MatchingStrategy> findByDownUuid(String useruuid,String provinceuuid,String operatoruid,String busuuid,String downprouuid,String upporductid);

	MatchingStrategy findByDownUuid(String useruuid,String provinceuuid,String operatoruid,String busuuid);

	MatchingStrategy findByDownUuidUp(String provinceuuid,String operatoruid,String busuuid,String upuseruuid);

	MatchingStrategy findByDownUuidUpFace(String provinceuuid,String operatoruid,String busuuid,String upuseruuid,String faceValue,String downprouuid);


	MatchingStrategy findByDownUuidUp(String useruuid,String provinceuuid,String operatoruid,String busuuid,String downprouuid,String upuseruuid);


    String addMatchingstrategy(JSONObject json, User user);

	int downCount(String downprouuid);

	int upSumUpUser(String downorderuuid);

	String queryStrategyPage(JSONObject json, int start, int pageSize);

	/**
	 * 更新排序
	 * @param json
	 * @return
	 */
	boolean updateStrategy(JSONObject json);

	String batchProductTimer(JSONObject json,User user);

	boolean findByCount(String upprouuid);

	boolean findByDownCount(String downprouuid);

	/**
	 * 批量编辑供货定时产品
	 * @param json
	 * @param login
	 * @return
	 */
	String batchProductTimerUp(JSONObject json, User login);
}
